﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MMDemo
{
    class NewListData:InterfaceNewData
    {
        public NewListData()
        {

        }
        public bool NewData()
        {
            switch(GlobalList.Operate_Type)
            {
                case ListOperateType.Insert:
                    NewInsertData(); break;
                case ListOperateType.Delete:
                    NewDeleteData(); break;
                case ListOperateType.Combination:
                    NewCombinateData(); break;
                case ListOperateType.Search:
                    NewSearch(); break;
            }
            return PublicDataClass.IsInit;
        }
        public void ShowForm(SysDemoForm demof, SysArithmeticForm arif, int Width, int Height)
        {
            demof.Top = 0;
            demof.Left = 0;
            demof.Width = Width - 500;
            demof.Height = Height;
            demof.Show();

            arif.Top = 0;
            arif.Left = Width - 500;
            arif.Width = 500;
            arif.Height = Height;
            arif.Show();
        }
        private void NewSearch()
        {
            LinearInitForm ndf = new LinearInitForm();
            ndf.ShowDialog();

            LinearSearchForm searchForm = new LinearSearchForm();
            searchForm.ShowDialog();
        }
        private void NewInsertData()
        {
            LinearInitForm ndf = new LinearInitForm();
            ndf.ShowDialog();
            if (PublicDataClass.IsInit)
            {
                LinearInsertForm idf = new LinearInsertForm();
                idf.ShowDialog();
                if (PublicDataClass.IsInit)
                {
                    LinearLocateForm lcf = new LinearLocateForm();
                    lcf.ShowDialog();
                }
            }
        }
        private void NewDeleteData()
        {
            LinearInitForm ndf = new LinearInitForm();
            ndf.ShowDialog();
            if (PublicDataClass.IsInit)
            {
                LinearLocateForm lcf = new LinearLocateForm();
                lcf.ChangeLabelText("删除的位置：");
                lcf.ShowDialog(); 
            } 
        }
        private void NewCombinateData()
        {
            LinearInitForm ndf = new LinearInitForm();
            ndf.ChangeLabelText("合并数据一：");
            ndf.ShowDialog();

            if (PublicDataClass.IsInit)
            {
                LinearInsertForm idf = new LinearInsertForm();
                idf.ChangeLabelText("合并数据二：");
                idf.ShowDialog(); 
            }
        }
    }
}
